<?php

namespace FmBundle\Controller;

use FmBundle\Entity\Collection;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FmBundle\Form\CollectionType;
use Symfony\Component\HttpFoundation\Request;


class DefaultController extends Controller
{
    public function indexAction(Request $request)
    {

        echo $this->getParameter('kernel.root_dir');

        $collction = new Collection();
        

        $form = $this->createForm(CollectionType::class, $collction);

        $form->handleRequest($request);

        if($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($collction);
            $em->flush();
        }

        return $this->render('FmBundle:Default:index.html.twig', ['form' => $form->createView()]);
    }
}
